#ifndef HSL_ASSERT_H
#define HSL_ASSERT_H

#include "hsl/Config.h"
#include <iostream>

/// HSL_MSG_ASSERT is the main function (actually a macro) defined in this file. 

#ifndef HSL_ASSERTIONS_OFF

/// internal function for use within this file
void onAssert();

/// internal macro for use within this file
#define hslMsgAssertFailed(expr, message, file, line) \
(std::cerr << "Assertion [" << #expr << "] failed with message [" << message << "] at [" << file << "] line [" << line << "]\n", onAssert())

/// Example Usage of Assertion:
/// HSL_MSG_ASSERT(list.size() > 3, "List is too small; the size of the list is " << list.size()); 
#define HSL_MSG_ASSERT(x, y) \
((x)? \
static_cast<void>(0) \
: hslMsgAssertFailed((#x), y, __FILE__, __LINE__))
#else
#define HSL_MSG_ASSERT(x, y) (static_cast<void>(0))
#endif

#endif